<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<title>编辑管理</title>
		<link rel="stylesheet" type="text/css" href="${ctx }/styles/displaytag.css" />
		<script type="text/javascript">
			function addEditor() {
				art.dialog.open(ctx + "/showOrdinaryEditor.html", {
					title : "新增专业顾问",
					width : "650px",
					height : "550px",
					lock : true
				});
			}
			
			function changeEditorLevel(id,level){
				var url = ctx + "/changeEditorLevel.html?ajax=true";
				var param = "&id=" + id + "&level=" + level;
				var sf = function (msg) {
					if (msg == 1 || msg == "1" || msg == "\"1\"") {
						art.dialog.tips("<label class='success'>修改成功！</label>", 1);
						window.location.reload();
						return true;
					}else if(msg == 2 || msg == "2" || msg == "\"2\""){
						art.dialog.tips("<label class='warn'>该专业顾问还有未完成的VIP服务！</label>", 1);
						return false;
					}else{
						art.dialog.tips("<label class='error'>修改失败，请刷新页面重试！</label>", 1);
						return false;
					}
				};
				ajax(url, param, sf);
			};
			
			function changeLevel(id,level){
				art.dialog({
				    content: '您确定要执行该操作吗？',
				    ok: function () {
				        return changeEditorLevel(id,level);
				    },
				    cancel: true,
					lock: true
				});
			}
		</script>
	</head>
	<body>
		<div class="container_16">
			<div class="grid_16">
				<div class="content_top">
					<span>编辑管理</span>
				</div>
				<div class="content_bottom">
					<div style="padding: 30px;">
						<a href="javascript:void(0)" title="新增专业顾问" onclick="addEditor()"><img alt="新增专业顾问" src="${ctx }/images/add_editor_in_chief.jpg"></a>
						<display:table id="editor" name="pageBean" pagesize="10" class="display_table" requestURI="">
							<display:column title="序号" value="${(pageBean.pageNumber - 1) * pageBean.objectsPerPage + editor_rowNum }" style="width: 5%" />
							<display:column title="专业顾问" property="nickname" style="width: 15%" />
							<display:column title="专业" property="majorName" style="width: 20%" />
							<display:column title="当前VIP任务" property="currentVip" style="width: 15%" href="undoneTask.html" paramId="id" paramProperty="id" />
							<display:column title="已完成VIP任务" property="completevip" style="width: 15%" href="accomplishTask.html" paramId="id" paramProperty="id" />
							<display:column title="注册时间" property="registtime" format="{0,date,yyyy-MM-dd}" style="width: 15%" />
							<display:column title="操作" style="width: 15%">
								<a href="javascript:void(0)" onclick="changeLevel(${editor.id },4)">取消专业顾问权限</a>
							</display:column>
						</display:table>
					</div>
				</div>
			</div>			
		</div>
	</body>
</html>